chore(key-wallet): drop the unused vendored PSBT implementation - #1041
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: dashpay/rust-dashcore/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (42)
💤 Files with no reviewable changes (38)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change removes key-wallet’s PSBT module, related tests and fixtures, Dash PSBT examples and script helpers, and the PSBT fuzz target. It also removes PSBT references from project documentation and updates related manifests and fuzz scripts. ChangesPSBT support removal
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: Merge Risk: ⚪ Minimal · up to The supplied evidence identifies no remaining issue that should delay merging this PSBT removal. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1041 +/- ##
==========================================
- Coverage 77.11% 77.01% -0.10%
==========================================
Files 329 320 -9
Lines 83577 81519 -2058
==========================================
- Hits 64447 62780 -1667
+ Misses 19130 18739 -391
|
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
c8240d7 to
1fba9b1
Compare
|
Bots are done — your move: post |
A security report pointed out that `PartiallySignedTransaction::sign()` signs each input with whatever sighash type the input declares, with no BIP174 whitelist: a hostile coordinator can set SIGHASH_NONE|ANYONECANPAY (0x82) on an input and the victim's signature is then valid for any other transaction spending that same input. The claim is accurate. `sighash_ecdsa()` only checked that the value was one of the six standard types, and 0x82 is standard. The behaviour is not ours, though: the whole module is a verbatim copy of rust-bitcoin's psbt (same `sign()`, same `sighash_ecdsa()`, same doc comments as bitcoin 0.32.5), which leaves the check to the BIP174 Signer role. Rather than add the whitelist, the module goes away, because nothing used it: - No other module in this workspace referenced `key_wallet::psbt`. `TransactionBuilder` does its own signing and hardcodes `EcdsaSighashType::All`. - `key-wallet-ffi` and `dash-spv-ffi` expose no PSBT symbol, so the mobile wallets could never reach it. - dashpay/platform, the one repository that depends on key-wallet by git, has zero occurrences of `psbt` in any .rs/.toml/.ts/.js file. - The two examples that did use it, `ecdsa-psbt` and `taproot-psbt`, declared `required-features = ["bitcoinconsensus"]` — a feature that does not exist in dash/Cargo.toml — so they have never once compiled. Most of it was meaningless here anyway: `output_type()` resolved inputs to `Wpkh`, `Wsh`, `ShWpkh` and `Tr`, computing segwit and taproot sighashes for a chain that has neither. Only `Bare` and `Sh` were reachable. Removed with it: the BIP174 vector test and its fixtures, the two examples plus the dash -> key-wallet dev-dependency cycle they created, the `dash_deserialize_psbt` fuzz target and key-wallet as a dash-fuzz dependency, key-wallet's now-unused optional `base64` dependency, and `ScriptBuf::p2wpkh_script_code()` with `Script::v0_p2wpkh()`, whose only callers in the workspace were the PSBT signer and each other. `walletcreatefundedpsbt` and friends in rpc-client are Dash Core RPC methods, not this code, and stay. Verified: cargo build --workspace --all-targets, cargo clippy --workspace --all-targets --all-features with no warnings, cargo fmt --check, cargo test -p key-wallet --all-features (646 passed), cargo test -p dashcore --all-features (628 + 37 + 12 + 1 passed), cargo doc with no broken intra-doc links. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1fba9b1 to
b45a13c
Compare
|
Bots are done — your move: post |
A security report pointed out that
PartiallySignedTransaction::sign()signs each input with whatever sighash type the input declares, with no BIP174 whitelist: a hostile coordinator can set SIGHASH_NONE|ANYONECANPAY (0x82) on an input and the victim's signature is then valid for any other transaction spending that same input.The claim is accurate.
sighash_ecdsa()only checked that the value was one of the six standard types, and 0x82 is standard. The behaviour is not ours, though: the whole module is a verbatim copy of rust-bitcoin's psbt (samesign(), samesighash_ecdsa(), same doc comments as bitcoin 0.32.5), which leaves the check to the BIP174 Signer role.Rather than add the whitelist, the module goes away, because nothing used it:
key_wallet::psbt.TransactionBuilderdoes its own signing and hardcodesEcdsaSighashType::All.key-wallet-ffianddash-spv-ffiexpose no PSBT symbol, so the mobile wallets could never reach it.psbtin any .rs/.toml/.ts/.js file.ecdsa-psbtandtaproot-psbt, declaredrequired-features = ["bitcoinconsensus"]— a feature that does not exist in dash/Cargo.toml — so they have never once compiled.Most of it was meaningless here anyway:
output_type()resolved inputs toWpkh,Wsh,ShWpkhandTr, computing segwit and taproot sighashes for a chain that has neither. OnlyBareandShwere reachable.Removed with it: the BIP174 vector test and its fixtures, the two examples plus the dash -> key-wallet dev-dependency cycle they created, the
dash_deserialize_psbtfuzz target and key-wallet as a dash-fuzz dependency, key-wallet's now-unused optionalbase64dependency, andScriptBuf::p2wpkh_script_code()withScript::v0_p2wpkh(), whose only callers in the workspace were the PSBT signer and each other.walletcreatefundedpsbtand friends in rpc-client are Dash Core RPC methods, not this code, and stay.Verified: cargo build --workspace --all-targets, cargo clippy --workspace --all-targets --all-features with no warnings, cargo fmt --check, cargo test -p key-wallet --all-features (646 passed), cargo test -p dashcore --all-features (628 + 37 + 12 + 1 passed), cargo doc with no broken intra-doc links.
PR Hygiene ·
b45a13c/self-reviewedREADME.md,dash/Cargo.toml,dash/examples/ecdsa-psbt.rsand 9 more) — QuantumExplorer or xdustinfacekey-wallet(key-wallet/Cargo.toml,key-wallet/README.md,key-wallet/TODO.mdand 27 more) — QuantumExplorer or xdustinfaceWhen every box is checked the
PR Hygienecheck passes and this can merge.Summary by CodeRabbit